package com.service.base;

import com.core.springSecurity.common.SecurityUtils;
import com.dao.base.BaseServiceStationInfoMapper;
import com.model.domain.base.GetBaseServiceStationInfoDO;
import com.model.dto.visual.GetVisualInfoDTO;
import com.model.pojo.base.BaseServiceStationInfo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;



/**
 * @Author: zql
 * @Description: 维修服务站信息服务
 * @Data: 2023-09-09
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class BaseServiceStationInfoService {
    private final BaseServiceStationInfoMapper baseServiceStationInfoMapper;
    public List<BaseServiceStationInfo> getPageList(GetBaseServiceStationInfoDO getBaseServiceStationInfoDO){
        PageHelper.clearPage();
        PageHelper.startPage(getBaseServiceStationInfoDO.getPage(), getBaseServiceStationInfoDO.getPageSize(), getBaseServiceStationInfoDO.getSortRow()+ getBaseServiceStationInfoDO.getSortOrder());
        return baseServiceStationInfoMapper.selectList(getBaseServiceStationInfoDO);
    }

    public int getCount(GetVisualInfoDTO dto){
        return baseServiceStationInfoMapper.countByPrimaryKey(dto);
    }

    public void update(BaseServiceStationInfo serviceStationInfo){
        serviceStationInfo.setLastUpdateTime(new Date());
        baseServiceStationInfoMapper.updateByPrimaryKeySelective(serviceStationInfo);
    }
}
